package com.tjcd.project.library_base.common.utils.other;

import io.reactivex.rxjava3.subjects.BehaviorSubject;

/**
 * @Author jiangKunKun
 * @CreateDate 2025/2/17
 * @Description 关联 ValueChangeUtils
 * @SpittingGrooves
 */
public class ValueChangeObserver<T> {
    private final BehaviorSubject<T> subject;

    public ValueChangeObserver(T defaultValue) {
        this.subject = BehaviorSubject.createDefault(defaultValue);
    }

    public void setValue(T value) {
        subject.onNext(value);
    }

    public BehaviorSubject<T> getSubject() {
        return subject;
    }
}
